package com.my.customtask;

import org.eclipse.bpmn2.modeler.core.IBpmn2RuntimeExtension;
import org.eclipse.bpmn2.modeler.core.preferences.Bpmn2Preferences;
import org.eclipse.bpmn2.modeler.core.utils.ModelUtil.Bpmn2DiagramType;
import org.eclipse.bpmn2.modeler.ui.DefaultBpmn2RuntimeExtension.RootElementParser;
import org.eclipse.bpmn2.modeler.ui.wizards.FileService;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.graphiti.ui.editor.DiagramEditor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IEditorInput;
import org.xml.sax.InputSource;


public class MyRuntimeExtension implements IBpmn2RuntimeExtension {

   @Override
   public boolean isContentForRuntime(IEditorInput input) {
      InputSource source = new InputSource( FileService.getInputContents(input) );
      RootElementParser parser = new RootElementParser("http://com.my.customtask");
      parser.parse(source);
      return parser.getResult();
   }

   @Override
   public String getTargetNamespace(Bpmn2DiagramType diagramType) {
      return "http://com.my.customtask";
   }

   @Override
   public String[] getTypeLanguages() {
      // TODO Auto-generated method stub
      return null;
   }

   @Override
   public String[] getExpressionLanguages() {
      // TODO Auto-generated method stub
      return null;
   }

   @Override
   public void initialize(DiagramEditor editor) {
      // TODO Auto-generated method stub

   }

   @Override
   public Composite getPreferencesComposite(Composite parent, Bpmn2Preferences preferences) {
      // TODO Auto-generated method stub
      return null;
   }

   @Override
   public void modelObjectCreated(EObject object) {
      // TODO Auto-generated method stub

   }

}
